local function GetStringsTable()
    return TUNING.NPC_CHAT_TABLE[ type(TUNING.__NPC_LANGUAGE)=="function" and TUNING.__NPC_LANGUAGE() or TUNING.__NPC_LANGUAGE ] ["npc_item_cards_station"] or {}
end
local function start_event(inst,player)
    if player.__npc_card_lightning_task_num == nil then
        player.__npc_card_lightning_task_num = math.random(40,60)
        player.npc_base_lib:Wisper(GetStringsTable().npc_card_lightning)
    elseif type(player.__npc_card_lightning_task_num) == "number" then
        player.__npc_card_lightning_task_num = player.__npc_card_lightning_task_num + math.random(40,60)
    end
    if player.__npc_card_lightning_task ~= nil or type(player.__npc_card_lightning_task_num) ~= "number" then
        return
    end
    player.__npc_card_lightning_task = player:DoPeriodicTask(1.5,function()
        TheWorld:PushEvent("ms_sendlightningstrike", Vector3(player.Transform:GetWorldPosition()) )
        player.__npc_card_lightning_task_num = player.__npc_card_lightning_task_num or 0
        player.__npc_card_lightning_task_num = player.__npc_card_lightning_task_num - 1
        if player.__npc_card_lightning_task_num <= 0 then
            player.__npc_card_lightning_task:Cancel()
            player.__npc_card_lightning_task = nil
            player.__npc_card_lightning_task_num = nil
        end
    end)

    -- inst:Remove()
end
local function fx()
    local inst = CreateEntity()
    inst.entity:AddTransform()

    inst:AddTag("INLIMBO")
    inst:AddTag("FX")

    if not TheWorld.ismastersim then
        return inst
    end

    inst:ListenForEvent("Set",function(inst,player)
        start_event(inst,player)
        inst:Remove()
    end)

    return inst
end

return Prefab("npc_card_lightning",fx)